Skip to content

CLI-26: Sub-agent Windows shortcuts, /switch-agent command, and UUID identifiers#519

Merged
dwash96 merged 28 commits into
cecli-dev:v0.100.0from
szmania:CLI-26-subagent-windows-shortcuts
May 20, 2026
Merged

CLI-26: Sub-agent Windows shortcuts, /switch-agent command, and UUID identifiers#519
dwash96 merged 28 commits into
cecli-dev:v0.100.0from
szmania:CLI-26-subagent-windows-shortcuts

Conversation

@szmania
Copy link
Copy Markdown

@szmania szmania commented May 19, 2026

Summary

This PR introduces the /switch-agent command, Ctrl+Shift keyboard shortcuts for agent switching, and UUID-based identifiers for sub-agents — improving usability in terminals like Windows Git Bash where Ctrl+Alt shortcuts are problematic, and enabling unambiguous identification when multiple sub-agents share the same name.

Key Changes

1. /switch-agent Command

  • New command: /switch-agent <agent-name> allows users to switch between the primary agent and sub-agents by name.
  • Tab completion: Auto-completes agent names including UUID prefixes for disambiguation.
  • TUI interception: The /switch-agent command is intercepted in the TUI input handler and processed immediately without LLM round-tripping, ensuring instant switching.
  • Non-TUI fallback: In non-TUI mode, the command sets foreground_uuid directly on the AgentService.
  • Help text: Includes usage examples and tab-completion guidance.

2. UUID Identifiers for Sub-Agents

  • 3-character UUID prefix: Sub-agent names in the UI now always include a 3-character UUID prefix (e.g., reviewer (a1b)) to uniquely identify agents when duplicate names exist.
  • UUID prefix matching: The /switch-agent command resolves agents by:
    1. "name (uuid)" format — e.g., /switch-agent reviewer (a1b)
    2. Direct name match — e.g., /switch-agent reviewer
    3. UUID prefix match — e.g., /switch-agent a1b
  • Completions always include UUID prefix: Tab-completion for /switch-agent always appends the UUID prefix to sub-agent names, making disambiguation seamless.
  • Duplicate name handling in TUI: When multiple sub-agents share the same name, the TUI input container appends the UUID prefix to distinguish them.

3. Ctrl+Shift Keybindings

  • The TUI now supports Ctrl+Shift+Left, Ctrl+Shift+Right, and Ctrl+Shift+Up for agent switching, providing an alternative to the existing Ctrl+Alt shortcuts that don't work well on Windows Git Bash.

4. Synchronous Linter & Command Execution

  • Reverted the Linter and shell command execution from async to synchronous (using asyncio.to_thread for run_cmd). This simplifies the codebase and improves reliability in interrupt handling.
  • Removed run_cmd_async and interruptible_async_generator — no longer needed.
  • Linter methods (lint, py_lint, flake8_lint, run_cmd) are now synchronous, using subprocess.run directly.

5. Bug Fixes

  • Resolved a circular import in cecli/commands/switch_agent.py.
  • Fixed an issue where the TUI would not visually update when switching agents.
  • Corrected a bug in cecli/commands/invoke_agent.py that was causing sub-agent invocation to fail (added MessageTag.CUR to the summary message).
  • Fixed spawn message to show Ctrl+Alt+Right instead of dynamic key lookup that could fail.

6. Cleanup

  • Removed interrupt_event parameter from Linter.__init__ and all lint-related methods.
  • Removed notification cooldown logic and notify_user_input_required call from InputOutput.
  • Removed stale interrupt state clearing from base_coder.py.
  • Removed unused Path() conversion in SkillsManager.find_skills.

Files Changed

  • cecli/commands/switch_agent.py — New /switch-agent command implementation
  • cecli/commands/__init__.py — Registered SwitchAgentCommand
  • cecli/commands/invoke_agent.py — Fixed sub-agent invocation, added MessageTag.CUR
  • cecli/commands/spawn_agent.py — Simplified spawn message
  • cecli/commands/lint.py — Synchronous lint call
  • cecli/commands/run.py — Synchronous run_cmd via asyncio.to_thread
  • cecli/tui/app.pyCtrl+Shift keybindings, /switch-agent interception, switch_agent message handling
  • cecli/coders/agent_coder.py — Synchronous lint, removed interruptible sleep
  • cecli/coders/base_coder.py — Synchronous lint, removed interruptible formatting/streaming
  • cecli/linter.py — Fully synchronous linter with subprocess.run
  • cecli/run_cmd.py — Removed run_cmd_async
  • cecli/helpers/coroutines.py — Removed interruptible_async_generator
  • cecli/helpers/skills.py — Removed unused Path() conversion
  • cecli/io.py — Removed notification cooldown and notify_user_input_required
  • cecli/models.py — Removed interruptible wrapper around litellm.acompletion
  • tests/commands/test_switch_agent.py — Tests for the new command

Why Needed

  • Ctrl+Alt shortcuts don't work in Windows Git Bash — Ctrl+Shift provides a working alternative.
  • The /switch-agent command gives users a CLI-based way to switch agents, with tab-completion for convenience.
  • UUID prefixes solve the ambiguity problem when multiple sub-agents share the same name (e.g., two "reviewer" agents).
  • Reverting to synchronous operations for linting and commands reduces complexity and potential race conditions in the async event loop.

Your Name added 28 commits May 18, 2026 17:33
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/nvidia_nim/deepseek-ai/deepseek-v4-pro)
Co-authored-by: cecli (openai/nvidia_nim/deepseek-ai/deepseek-v4-pro)
Co-authored-by: cecli (openai/nvidia_nim/deepseek-ai/deepseek-v4-pro)
Co-authored-by: cecli (openai/nvidia_nim/deepseek-ai/deepseek-v4-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/nvidia_nim/deepseek-ai/deepseek-v4-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro)
@szmania szmania changed the title Cli 26 subagent windows shortcuts CLI-26: Sub-agent Windows shortcuts, /switch-agent command, and UUID identifiers May 19, 2026
@dwash96 dwash96 merged commit 83c7e1e into cecli-dev:v0.100.0 May 20, 2026
1 check passed
@dwash96 dwash96 mentioned this pull request May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants